package org.jeecg.modules.reportLabel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.jeecg.modules.inOrder1.entity.Bar;
import org.jeecg.modules.reportLabel.entity.ReportLabel;
import org.jeecg.modules.reportLabel.mapper.ReportLabelMapper;
import org.jeecg.modules.reportLabel.service.IReportLabelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: 标签统计报表
 * @Author: jeecg-boot
 * @Date:   2023-12-01
 * @Version: V1.0
 */
@Service
public class ReportLabelServiceImpl extends ServiceImpl<ReportLabelMapper, ReportLabel> implements IReportLabelService {
    @Autowired
    private ReportLabelMapper reportLabelMapper;

    @Override
    public ReportLabel getByCode(String code) {
        LambdaQueryWrapper<ReportLabel> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(ReportLabel::getBarCode, code);
        return baseMapper.selectOne(wrapper);
    }

    @Override
    public int countByCode(String code) {
        LambdaQueryWrapper<ReportLabel> wrapper = Wrappers.lambdaQuery();
        wrapper.eq(ReportLabel::getBarCode, code);
        return baseMapper.selectCount(wrapper);
    }

    @Override
    public List<Bar> getBar() {
        return reportLabelMapper.getBar();
    }
}
